<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ page import="com.cy.utils.dingtalk.DingTalkUtils" %>
<c:if test="${empty config}">
    <c:set var="config" value="<%=DingTalkUtils.getJsapiConfig(request)%>"/>
</c:if>
<script type="text/javascript" src="${gPath}/scripts/jquery/jquery-1.8.1.min.js"></script>
<script type="text/javascript" src="https://g.alicdn.com/ilw/ding/0.9.9/scripts/dingtalk.js"></script>
<script type="text/javascript">
    var _config = ${config};
    dd.config({
        agentId : _config.agentid,
        corpId : _config.corpId,
        timeStamp : _config.timeStamp,
        nonceStr : _config.nonceStr,
        signature : _config.signature,
        jsApiList : ['biz.util.scan','biz.navigation.setMenu','device.notification.confirm','device.notification.alert','device.notification.modal','biz.navigation.setRight',
                     'dd.biz.navigation.close']
    });

    dd.error(function(err) {
        if (err.message.indexOf("52013") != -1){
            $.post("${gPath}/dingtalk/updateTicket", function () {
                window.location.reload();
            });
        } else {
            alert('dd error: ' + JSON.stringify(err));
        }
    });
</script>